Skip to content

Fix scalar conversion error with NumPy 2.x#31

Open
BenjaminZoller wants to merge 7 commits intoLoLab-MSM:masterfrom
BenjaminZoller:fix-numpy2-scalar-conversion
Open

Fix scalar conversion error with NumPy 2.x#31
BenjaminZoller wants to merge 7 commits intoLoLab-MSM:masterfrom
BenjaminZoller:fix-numpy2-scalar-conversion

Conversation

@BenjaminZoller
Copy link

This PR fixes a NumPy 2.x compatibility issue in the crossover probability update.

np.where(...)[0] returns a 1-D array; converting it with int() fails under
NumPy ≥ 2.0 with:

TypeError: only 0-dimensional arrays can be converted to Python scalars

The fix replaces the implicit conversion with an explicit scalar extraction
using .item().

Tested locally with NumPy 2.4.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant